# hub.docker.com  docker pull php:7.2.1-apache

FROM php:7.2.1-apache

MAINTAINER manarch.liu "manarch6@gmail.com"

USER root

# 添加自己的PHP配置文件
# COPY config/php.ini /usr/local/etc/php/

# 更新系统源
# RUN rm /var/lib/apt/lists/* -vf
COPY config/sources.list /etc/apt/
RUN cd ~ && apt-get update

# 拷贝代码到Apache工作目录
COPY src/ /var/www/html/

# 下载memcached扩展包
ADD http://pecl.php.net/get/memcached-3.0.4.tgz /usr/src/php/ext/

# 下载Redis扩展包
ADD http://pecl.php.net/get/redis-3.1.6.tgz /usr/src/php/ext/

# 解压扩展包
RUN cd /usr/src/php/ext/ && tar -zxvf redis-3.1.6.tgz && tar -zxvf memcached-3.0.4.tgz

# 安装依赖包
RUN apt-get install -y libmemcached-dev zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev

# 安装扩展
RUN /usr/local/bin/docker-php-ext-install gd memcached-3.0.4 redis-3.1.6 pdo_mysql opcache

# 下载composer
ADD https://getcomposer.org/composer.phar /usr/local/bin/composer
RUN chmod +x /usr/local/bin/composer

# 设置共享目录（开发环境开启，生产环境关闭）
# VOLUME ["/Users/manarch/CodeProject/PhpProject/test"]
